import api from "@/api";
import { PORT } from "../config/servicePort";

/**
 * 获取任务列表
 */
export const getTaskList = (data: any) => api.post(`${PORT}/api/dispatcher/job/page`, data);

// 添加任务
export const createTask = (data: any) => api.post(`${PORT}/api/dispatcher/job/save`, data);
// 修改任务
export const updateTask = (data: any) => api.post(`${PORT}/api/dispatcher/job/update`, data);
// 同步任务到redis
export const taskToRedis = (data: any) => api.post(`${PORT}/api/dispatcher/queue/sync`, data);
// 获取任务详情
export const getTaskDetail = (data: any) => api.post(`${PORT}/api/dispatcher/job/detail/${data.id}`);
// 获取任务步骤详情
export const getTaskProcess = (data: any) => api.post(`${PORT}/api/dispatcher/job/steps/${data.id}`);


//开始任务
export const startTaskApi = (data: any) => api.post(`${PORT}/api/dispatcher/queue/start/${data.id}`);
//取消任务
export const cancelTaskApi = (data: any) => api.post(`${PORT}/api/dispatcher/queue/cancel/${data.id}`);
//下发任务
export const distributeTaskApi = (data: any) => api.post(`${PORT}/api/dispatcher/queue/dispatch/${data.id}`);
//中止任务
export const stopTaskApi = (data: any) => api.post(`${PORT}/api/dispatcher/queue/abort/${data.id}`);
//更新任务排序
export const updateTaskOrder = (data: any) => api.post(`${PORT}/api/dispatcher/job/updateFifo`, data);
//复制任务
export const copyTaskApi = (data: any) => api.post(`${PORT}/api/dispatcher/job/copy/${data.id}`);
//删除任务
export const deleteTaskApi = (data: any) => api.post(`${PORT}/api/dispatcher/job/delete/${data.id}`);

